﻿Public Class clsLHJWorkDetail
    Private tempval As String = "temp_val_1,temp_val_2,temp_val_3,temp_val_4,temp_val_5,
    temp_val_6,temp_val_7,temp_val_8,temp_val_9,temp_val_10,
    temp_val_11,temp_val_12,temp_val_13,temp_val_14,temp_val_15,
    temp_val_16,temp_val_17,temp_val_18,temp_val_19,temp_val_20"

    ''' <summary>
    ''' 折线图数据查询
    ''' </summary>
    ''' <param name="lhj_id">lhj_id</param>
    ''' <param name="prod_id">生产编号</param>
    ''' <returns></returns>
    Public Function selectLHJWorkDetailInfoDESC(lhj_id As String, prod_id As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT prod_id," & tempval & ",pres_val1,pres_val2,col_time,status,lh_time_len,lhsysj,zsc,lhjsc,old_status "
        szSql &= " FROM sf.b_lhj_work_detail WHERE factory_id=? and prod_id=? and lhj_id = ? ORDER BY col_time DESC"
        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, g_factory_id, prod_id, lhj_id)
        If IsNothing(dt) Then
            selectLHJWorkDetailInfoDESC = New DataTable
        Else
            selectLHJWorkDetailInfoDESC = dt
        End If
    End Function

    Public Function insertData(en As entity_LHDataInput) As Integer

        Dim szSql As String = ""
        Dim rtn As Integer

        szSql &= " INSERT INTO sf.b_lhj_work_detail( factory_id , prod_id , lhj_id , col_time , "
        szSql &= tempval
        szSql &= " , pres_val1, pres_val2 , update_time , lh_time_len, status,zsc,lhjsc,lhsysj,old_status )  "
        szSql &= " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)  "

        rtn = DBacs.ExecuteUpdateSql(szSql, -1, en.factory_id, en.prod_id, en.lhj_id, en.col_time,
        en.temp_val_1, en.temp_val_2, en.temp_val_3, en.temp_val_4, en.temp_val_5,
        en.temp_val_6, en.temp_val_7, en.temp_val_8, en.temp_val_9, en.temp_val_10,
        en.temp_val_11, en.temp_val_12, en.temp_val_13, en.temp_val_14, en.temp_val_15,
        en.temp_val_16, en.temp_val_17, en.temp_val_18, en.temp_val_19, en.temp_val_20,
        en.pres_val1, en.pres_val2, en.update_time, en.lh_time_len, en.status, en.zsc, en.lhjsc, en.lhsysj, en.old_status)

        Return rtn
    End Function
End Class

Public Class entity_LHDataInput
    Public factory_id As String
    Public prod_id As String
    Public lhj_id As String
    Public col_time As String
    Public status As String
    Public temp_val_1 As Double
    Public temp_val_2 As Double
    Public temp_val_3 As Double
    Public temp_val_4 As Double
    Public temp_val_5 As Double
    Public temp_val_6 As Double
    Public temp_val_7 As Double
    Public temp_val_8 As Double
    Public temp_val_9 As Double
    Public temp_val_10 As Double
    Public temp_val_11 As Double
    Public temp_val_12 As Double
    Public temp_val_13 As Double
    Public temp_val_14 As Double
    Public temp_val_15 As Double
    Public temp_val_16 As Double
    Public temp_val_17 As Double
    Public temp_val_18 As Double
    Public temp_val_19 As Double
    Public temp_val_20 As Double

    Public pres_val1 As Double
    Public pres_val2 As Double
    Public lh_time_len As Integer
    Public lhsysj As Integer
    Public zsc As Integer
    Public lhjsc As Integer
    Public update_time As String
    Public old_status As String
End Class
